package zyd.springboot.springbootmybatis.service;

import zyd.springboot.springbootmybatis.entity.User;
import zyd.springboot.springbootmybatis.service.ex.InsertException;
import zyd.springboot.springbootmybatis.service.ex.LoginException;
import zyd.springboot.springbootmybatis.service.ex.UsernameDuplicateException;

/**
 * 用户模块的业务层父接口
 */
public interface UserService {//有异常处理的业务层，登陆注册

    /**
     * 用户登录
     * @param user
     * @return 用户对象 或 null
     * @throws LoginException
     */
    User login(User user) throws LoginException;

    /**
     * 用户注册
     * @param user 用户信息
     * @throws UsernameDuplicateException
     * @throws InsertException
     */

    void register(User user) throws UsernameDuplicateException, InsertException;

}
